/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.math.ColorRGBA;
import com.jme3.niftygui.NiftyJmeDisplay;
import de.lessvoid.nifty.Nifty;

/**
 * @date 2024年7月12日14点08分
 * @author JohnKkk
 */
public class NiftyGuiLabel extends SimpleApplication{

    private Nifty m_Nifty;
    
    public static void main(String[] args) {
        NiftyGuiLabel niftyGuiLabel = new NiftyGuiLabel();
        niftyGuiLabel.start();
    }

    @Override
    public void simpleInitApp() {
        // 设置默认背景色
        getViewPort().setBackgroundColor(ColorRGBA.DarkGray);
        
        // 初始化Nifty
        NiftyJmeDisplay niftyDisplay = NiftyJmeDisplay.newNiftyJmeDisplay(
                assetManager,
                inputManager,
                audioRenderer,
                guiViewPort);
        m_Nifty = niftyDisplay.getNifty();
        // 将NiftyGUI显示对象添加到JME3中
        guiViewPort.addProcessor(niftyDisplay);
        
        m_Nifty.fromXml("Interface/NiftyGuiLabel.xml", "screen0");
        
        // 禁用flyCam并显示鼠标
        flyCam.setEnabled(false);
        inputManager.setCursorVisible(true);
    }
    
}
